package com.qidian.buy.goods.controller;

import com.mysql.cj.log.Log;
import com.qidian.buy.common.pojo.BuyResult;
import com.qidian.buy.goods.service.IItemSpecificationService;
import com.qidian.buy.pojo.ItemSpecification;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 戴着假发的程序员
 * @company 起点编程
 * @date 2024/7/17 9:53
 */
@CrossOrigin
@RestController
@RequestMapping("/spe")
public class ItemSpecificationController {
    @Autowired
    private IItemSpecificationService speService;

    @GetMapping("/get")
    public BuyResult get(Long speId){
        return speService.get(speId);
    }
    @RequestMapping("/save")
    public BuyResult save(@RequestBody ItemSpecification spe){
        return speService.saveSpe(spe);
    }

    @GetMapping("/list")
    public BuyResult list(ItemSpecification spe,@RequestParam(defaultValue = "1")int page,@RequestParam(defaultValue = "10")int limit){
        return speService.queryList(page,limit,spe);
    }
}
